<?php
class user_roletree_1 extends Update_Model_Database_AbstractChange{

	protected $comment="Создание таблицы user_roletree";

	public function up(){
		$sql="CREATE TABLE IF NOT EXISTS user_roletree(
				  id INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id = cid',
				  parent_id INT(11) NOT NULL,
				  `left` INT(11) NOT NULL,
				  `right` INT(11) NOT NULL,
				  level INT(11) NOT NULL,
				  type VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
				  PRIMARY KEY (id)

			)
				ENGINE = INNODB
				CHARACTER SET utf8
				COLLATE utf8_general_ci;";
		$this->db->query($sql);
	}

	public function down(){
		$sql='DROP TABLE IF EXISTS user_roletree;';
		$this->db->query($sql);
	}

}